<!--管理员年度开设专业-->
<template>
  <div class="assessment-container">
    <div class="search-container">
      <div class="search-container-right">
        <div
          class="cjrc-button"
          @click="toMakeScore"
        >
          <span>设置年度开设专业</span>
        </div>
      </div>
    </div>
    <div class="plan-entry-table-container" style="padding:none;">
      <el-table
        :data="tableData"
        @selection-change="handleSelectionChange"
        class="xpaas-table-class"
        row-class-name="xpaas-row-class"
        cell-class-name="xpaas-cell-class"
        header-row-class-name="xpaas-header-row-class"
        header-cell-class-name="xpaas-header-cell-class"
      >
        <el-table-column prop="year" label="年度" align="center">
        </el-table-column>
        <el-table-column prop="num" label="开设专业数量" align="center">
          <template slot-scope="scope">
            <div style="display: flex; margin: 0 auto; width: 80px ;">
              <div class="bk-lucj-import-button" @click="bj(scope.$index)" style="width: 80px;cursor: pointer;">
                <span>{{ scope.row.num }}</span>
                <img
                  src="../../../assets/assessment/icon-plan-record-detail.png"
                  alt=""
                  style="margin-left: 10px"
                />
              </div>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="bottom-block">
      <div class="export-button" style="margin-top:15px">
        <img src="../../../assets/assessment/icon-export.png" alt=""/>
        <download-excel
          class="export-btn"
          :data="tableData"
          :fields="jsonFields"
          type="xls"
          name="年度开设专业.xls"
          style="color: #f3b815;cursor: pointer"
        >
          &ensp;导出Excel
        </download-excel>
      </div>
    </div>

  </div>
</template>

<script>
import { ndkszy } from "@/api/professional/details";
export default {
  data() {
    return {
      jsonFields: {
        年度: "year",
        开设专业数量: "num",
      },
      tableData: [],
      designcontent: "",
      coursename: "",
      teachingfaculty: "",
      showExportReportDialog: false,
      showExportReportDialogags: false,
      showInportReportDialog: false,
    };
  },
  mounted() {
    this.ndkszy();
  },
  methods: {
    toMakeScore() {
         this.$router.push({ path: "/admin/professional/setup" });
    },
    //页面数据
    ndkszy() {
      ndkszy().then((res) => {
        this.tableData = res.data.data;
        console.log(res.data.data, 888);
      });
    },
    bj(index){
      this.$router.push({ path: "/admin/professional/inquire",query:{year: this.tableData[index].year} });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    handleSelectionChange(val) {
      //定义一个临时数组
      for (var i = 0; i < val.length; i++) {
        //循环遍历当前数组
        //判断当前数组下标为i的元素是否已经保存到临时数组
        //如果已保存，则跳过，否则将此元素保存到临时数组中
        if (this.planidArr.indexOf(val[i].planid) == -1) {
          this.planidArr.push(val[i].planid);
        }
      }
      console.log(this.planidArr);
    },

    downLoadExcel() {
      console.log(1231231);
      let el = this;
      let planid = this.tableData[this.reportIndex].planid;
      let href =
        window._CONFIG.previewurl +
        `/scorequery/downLoadExcel?planid=${planid}`;
      let alink = document.createElement("a");
      el.$message({
        showClose: true,
        message: "下载中，请稍后",
        type: "success",
      });
      alink.style.display = "none";
      alink.download = "按课程导出.word"; //下载后文件名
      alink.href = href;
      document.body.appendChild(alink);
      alink.click();
      document.body.removeChild(alink); //下载完成移除元素
    },
  },
};
</script>
<style lang="less" scoped>
.cjrc-button {
  cursor: pointer;
  width: 160px;
  height: 28px;
  line-height: 28px;
  background: #f1fff8;
  border: 1px solid #02c86c;
  border-radius: 6px;
  color: #02c86c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.export-button {
  width: 130px;
    background: #fff6ef;
    border: 1px solid #f3b815;
    height: 28px;
    line-height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;

    > span {
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }

    > img {
      width: 16px;
      height: 16px;
      margin-right: 5px;
    }
  }
.assessment-container {
  width: 100% !important;
  .export-report-container {
    .el-dialog__body {
      padding: 64px 0 64px 50px;
      .el-radio {
        margin-right: 79px;
      }
    }
    .el-dialog__footer {
      padding-bottom: 103px;
    }
  }
  .block {
    margin-top: 30px;
    .el-pagination {
      width: 500px;
      margin: 0 auto;
    }
  }
  .bk-lucj-import-button {
    img {
      width: 14px;
      height: 14px;
      background-size: 100% 100%;
      background-repeat: no-repeat;
    }
  }
  .import-button {
    background: #f1fff8 !important;
    border: 1px solid #02c86c !important;
    border-radius: 6px !important;
    span {
      color: #02c86c !important;
    }
  }
}
.plan-entry-table-container {
  margin-top: 15px;
  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }
  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }
  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }
  .el-checkbox__inner:hover {
    border-color: #004ca7;
  }
  .el-checkbox__inner {
    border: 1px solid #004ca7;
    border-radius: 0;
  }
  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #004ca7;
    border-color: #004ca7;
  }
  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #004ca7;
  }
  .el-checkbox.is-bordered.is-checked {
    border-color: #004ca7;
  }
  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: #004ca7;
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/print-entry.less";
.plan-entry-table-container {
  margin-top: 15px;
  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 50px;

            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}
</style>
